package com.beerandjesus.sportofkings.handicapper.model;

import java.util.Map;
import java.util.List;

/**
 * Interface for a simple table of results from the analysis of
 * a race. Useful for constructing ouptput of the data in mostly
 * simple formats.
 */
public interface ResultsTable {
	
	/**
	 * Put a column value in the table for a given horse.
	 * @param postPosition The post position of the horse
	 * @param resultType The type of result for this post
	 * 		  position. The last value set for any given
	 * 		  post position takes precedence.
	 * @param header The column header for this piece of data
	 * @param value The data for this horse and data type
	 */
	public abstract void putValue(Integer postPosition, ResultType resultType,
			String header, String value);

	/**
	 * Get the table of analysis results. The containing map holds
	 * a map of data for each horse. The Integer index of the
	 * containing map is each horse's post position. Index 0 contains
	 * the column names for the data rows. The contained map holds
	 * each piece of data by column index. 
	 *
	 * @return The table data
	 */
	public abstract Map<Integer, Map<Integer, String>> getTable();
	
	/**
	 * Get a simple representation of the data ordered by post position.
	 * @return The string output
	 */
	public abstract String toStringSimple();

	/**
	 * Get a representation of the data ordered first by result type, then
	 * by post position(ish).
	 * @return The string output
	 */
	public abstract String toStringByType();

    /**
     * Get the value for a given column and horse.
     * @param postPosition The post position of the horse
     * @param header The column name
     * @return The value
     */
    public abstract String getValue(Integer postPosition, String header);

    /**
     * Add a list of profiles for a given horse.
     * @param pp The post position of the horse
     * @param type The result type for the horse
     * @param profs The profiles applicable to the horse
     */
    public abstract void putProfiles(Integer pp, ResultType type, List<AnalysisProfile> profs);
}